import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';

import { Customer } from '../domain/customer'
import 'rxjs/add/operator/toPromise';

@Injectable()
export class CustomerService {

    constructor(private http: Http) { }

    getCustomersList() {
        return this.http.get('assets/mock-data/customers-list.json')
            .toPromise()
            .then(res => <Customer[]>res.json().data)
            .then(data => { return data; });
    }
}